package com.strp.mptcp.ACK;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator; /**
 * 普通 ACK 头，包类型 = 1，跟随一个 long 类型的 largestContiguousSeq。
 */
public class AckHeader {
    public static final byte TYPE = 1;
    private final long largestContiguousSeq;

    public AckHeader(long largestContiguousSeq) {
        this.largestContiguousSeq = largestContiguousSeq;
    }

    public ByteBuf toByteBuf() {
        ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(1 + 8);
        buf.writeByte(TYPE);
        buf.writeLong(largestContiguousSeq);
        return buf;
    }
}
